<template>
  <div
    class="all"
    :style="{ height: screenHeight + 'px', width: screenWidth + 'px' }"
  >
    <Return txt="打卡" style="background: #eeeeee"></Return>
    <div class="bom">
      <div class="bom1">打卡</div>
    </div>
    <div class="col">
      <div class="col1" @click="timeTap">2020年8月</div>
    </div>
    <div class="title">打卡记录</div>
    <div class="list" v-for="item of 5">
      <div class="list1" style="background:#16A5B6;color:#fff">{{ item }}</div>
      <div class="list2" style="color:red">未签到</div>
      <div class="list3">
        <span>8:00</span>
        <span style="color: #fff"  @click="timexianTap">签到成功</span>
        <div class="dian"  @click="timexianTap"></div>
      </div>
      <div class="list2" style="color:red">早退</div>
      <div class="list3">
        <span>18:00</span>
        <span style="color: #fff"  @click="timexianTap">签退成功</span>
          <div class="dian" @click="timexianTap"></div>
      </div>
    </div>
    <van-popup v-model="show" position="bottom">
      <van-datetime-picker
        v-model="currentDate"
        type="year-month"
        title="选择年月"
        :min-date="minDate"
        @cancel="show = false"
        @confirm="onCoshownfirm"
        :max-date="maxDate"
        :formatter="formatter"
      />
    </van-popup>
  </div>
</template>
<script>
import Return from "../../../components/return";
export default {
  components: {
    Return,
  },
  data() {
    return {
      minDate: new Date(2020, 0, 1),
      maxDate: new Date(2025, 10, 1),
      currentDate: new Date(),
      show: false,
            screenWidth: window.innerWidth,
      screenHeight: window.innerHeight,
    };
  },
  methods: {
    formatter(type, val) {
      if (type === "year") {
        return `${val}年`;
      } else if (type === "month") {
        return `${val}月`;
      }
      return val;
      console.log(val)
    },
    onCoshownfirm(){
    console.log(this.currentDate)
    },
    timeTap() {
      this.show = true;
    },
    timexianTap(){
      this.$router.push('/dakaindex');
    }
  },
};
</script>
<style scoped>
.bom {
  height: 200px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #4AC7D7;
}
.all {
  background: #4AC7D7;
}
.bom1 {
  width: 120px;
  height: 120px;
  text-align: center;
  line-height: 120px;
  border-radius: 50%;
  background: #fff;
  color: #55D0E2;
  font-size: 22px;

}
.col {
  height: 80px;
  width: 100%;

  display: flex;
  align-items: center;
  justify-content: center;
}
.col1 {
  width: 80%;
  height: 50px;
  text-align: center;
  line-height: 50px;
  background: #16A5B6;
  border-radius: 50px;
  color: #fff;
}
.title {
  height: 30px;
  width: 97%;
  padding-left: 3%;
  background: #16A5B6;
  font-size: 13px;
  color: #cecece;
  line-height: 30px;
}
.list {
  display: flex;
  height: 50px;
  width: 94%;
  margin-left: 3%;
  border-bottom: 1px solid #cccccc;
  align-items: center;
  font-size: 12px;
}
.list1 {
  width: 10%;
  height: 50px;
  background: #f2f2f2;
  border-bottom: 1px solid #cccccc;
  text-align: center;
  line-height: 70px;
}
.list2 {
  width: 20%;
  text-align: center;
  color: #cccccc;
}
.list3 {
  width: 30%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  height: 100%;
}
.dian{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #007ACC;
  position: absolute;
  bottom: -5px;
  left: 43%;
}
</style>